﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.ComponentModel;
using System.Runtime.Serialization;

namespace UMLObjects
{
    public class Activity : IDragable, IUMLObject, INotifyPropertyChanged //INotify casts an event when something is changed. In this way the UI is updated.
    {
        private string name = "New Activity";
        private Point position;
        private Point prePosition;

        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }

        //Receive/send name. If empty insert "Insert name".
        public string Name
        {
            get { return name; }
            set { 
                name = (value == "") ? "" : value;
                NotifyPropertyChanged("Name");
                }
        }

        //Receive/send position
        public Point Position
        {
            get { return position; }
            set { 
                position = value;
                NotifyPropertyChanged("Position");
                }
        }

        public Point PrePosition
        {
            get { return prePosition; }
            set
            {
                prePosition = value;
                NotifyPropertyChanged("PrePosition");
            }
        }

    }
}
